home *** CD-ROM | disk | FTP | other *** search
/ Champak 147 / (Vol 147) Jan 21 2012.iso / Interface / mod.000 / scripts / __Packages / mx / controls / RadioButton.as < prev    next >
Text File  |  2012-01-21  |  6KB  |  227 lines

  1. class mx.controls.RadioButton extends mx.controls.Button
  2. {
  3.    static var symbolName = "RadioButton";
  4.    static var symbolOwner = mx.controls.RadioButton;
  5.    static var version = "2.0.2.126";
  6.    var className = "RadioButton";
  7.    var btnOffset = 0;
  8.    var __toggle = true;
  9.    var __label = "Radio Button";
  10.    var __labelPlacement = "right";
  11.    var ignoreClassStyleDeclaration = {Button:1};
  12.    var __groupName = "radioGroup";
  13.    var indexNumber = 0;
  14.    var offset = false;
  15.    var falseUpSkin = "";
  16.    var falseDownSkin = "";
  17.    var falseOverSkin = "";
  18.    var falseDisabledSkin = "";
  19.    var trueUpSkin = "";
  20.    var trueDownSkin = "";
  21.    var trueOverSkin = "";
  22.    var trueDisabledSkin = "";
  23.    var falseUpIcon = "RadioFalseUp";
  24.    var falseDownIcon = "RadioFalseDown";
  25.    var falseOverIcon = "RadioFalseOver";
  26.    var falseDisabledIcon = "RadioFalseDisabled";
  27.    var trueUpIcon = "RadioTrueUp";
  28.    var trueDownIcon = "";
  29.    var trueOverIcon = "";
  30.    var trueDisabledIcon = "RadioTrueDisabled";
  31.    var centerContent = false;
  32.    var borderW = 0;
  33.    var clipParameters = {labelPlacement:1,data:1,label:1,groupName:1,selected:1};
  34.    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.RadioButton.prototype.clipParameters,mx.controls.Button.prototype.clipParameters);
  35.    function RadioButton()
  36.    {
  37.       super();
  38.    }
  39.    function init(Void)
  40.    {
  41.       this.setToggle(this.__toggle);
  42.       this.__value = this;
  43.       super.init();
  44.    }
  45.    function size(Void)
  46.    {
  47.       super.size();
  48.    }
  49.    function onRelease()
  50.    {
  51.       if(this.selected)
  52.       {
  53.          return undefined;
  54.       }
  55.       this.releaseFocus();
  56.       this.phase = "up";
  57.       this.setSelected(true);
  58.       this.dispatchEvent({type:"click"});
  59.       this._parent[this.__groupName].dispatchEvent({type:"click"});
  60.    }
  61.    function setData(val)
  62.    {
  63.       this.__data = val;
  64.    }
  65.    function set data(val)
  66.    {
  67.       this.__data = val;
  68.    }
  69.    function getData(val)
  70.    {
  71.       return this.__data;
  72.    }
  73.    function get data()
  74.    {
  75.       return this.__data;
  76.    }
  77.    function onUnload()
  78.    {
  79.       if(this._parent[this.__groupName].selectedRadio == this)
  80.       {
  81.          this._parent[this.__groupName].selectedRadio = undefined;
  82.       }
  83.       this._parent[this.__groupName].radioList[this.indexNumber] = null;
  84.       delete this._parent[this.__groupName].radioList[this.indexNumber];
  85.    }
  86.    function setSelected(val)
  87.    {
  88.       var _loc2_ = this._parent[this.__groupName];
  89.       var _loc4_ = _loc2_.selectedRadio.__width;
  90.       var _loc5_ = _loc2_.selectedRadio.__height;
  91.       if(val)
  92.       {
  93.          _loc2_.selectedRadio.setState(false);
  94.          _loc2_.selectedRadio = this;
  95.       }
  96.       else if(_loc2_.selectedRadio == this)
  97.       {
  98.          _loc2_.selectedRadio.setState(false);
  99.          _loc2_.selectedRadio = undefined;
  100.       }
  101.       this.setState(val);
  102.    }
  103.    function deleteGroupObj(groupName)
  104.    {
  105.       delete this._parent[groupName];
  106.    }
  107.    function getGroupName()
  108.    {
  109.       return this.__groupName;
  110.    }
  111.    function get groupName()
  112.    {
  113.       return this.__groupName;
  114.    }
  115.    function setGroupName(groupName)
  116.    {
  117.       if(groupName == undefined || groupName == "")
  118.       {
  119.          return undefined;
  120.       }
  121.       delete this._parent[this.__groupName].radioList[this.__data];
  122.       this.addToGroup(groupName);
  123.       this.__groupName = groupName;
  124.    }
  125.    function set groupName(groupName)
  126.    {
  127.       this.setGroupName(groupName);
  128.    }
  129.    function addToGroup(groupName)
  130.    {
  131.       if(groupName == "" || groupName == undefined)
  132.       {
  133.          return undefined;
  134.       }
  135.       var _loc2_ = this._parent[groupName];
  136.       if(_loc2_ == undefined)
  137.       {
  138.          var _loc0_ = null;
  139.          _loc2_ = this._parent[groupName] = new mx.controls.RadioButtonGroup();
  140.          _loc2_.__groupName = groupName;
  141.       }
  142.       _loc2_.addInstance(this);
  143.       if(this.__state)
  144.       {
  145.          _loc2_.selectedRadio.setState(false);
  146.          _loc2_.selectedRadio = this;
  147.       }
  148.    }
  149.    function get emphasized()
  150.    {
  151.       return undefined;
  152.    }
  153.    function keyDown(e)
  154.    {
  155.       switch(e.code)
  156.       {
  157.          case 40:
  158.             this.setNext();
  159.             break;
  160.          case 38:
  161.             this.setPrev();
  162.             break;
  163.          case 37:
  164.             this.setPrev();
  165.             break;
  166.          case 39:
  167.             this.setNext();
  168.       }
  169.    }
  170.    function setNext()
  171.    {
  172.       var _loc2_ = this._parent[this.__get__groupName()];
  173.       if(_loc2_.selectedRadio.indexNumber + 1 == _loc2_.radioList.length)
  174.       {
  175.          return undefined;
  176.       }
  177.       var _loc4_ = !_loc2_.selectedRadio ? -1 : _loc2_.selectedRadio.indexNumber;
  178.       var _loc3_ = 1;
  179.       while(_loc3_ < _loc2_.radioList.length)
  180.       {
  181.          if(_loc2_.radioList[_loc4_ + _loc3_] != undefined && _loc2_.radioList[_loc4_ + _loc3_].enabled)
  182.          {
  183.             var _loc5_ = this.getFocusManager();
  184.             _loc2_.radioList[_loc4_ + _loc3_].selected = true;
  185.             _loc5_.setFocus(_loc2_.radioList[_loc2_.selectedRadio.indexNumber]);
  186.             _loc2_.dispatchEvent({type:"click"});
  187.             break;
  188.          }
  189.          _loc3_ = _loc3_ + 1;
  190.       }
  191.    }
  192.    function setPrev()
  193.    {
  194.       var _loc2_ = this._parent[this.__get__groupName()];
  195.       if(_loc2_.selectedRadio.indexNumber == 0)
  196.       {
  197.          return undefined;
  198.       }
  199.       var _loc4_ = !_loc2_.selectedRadio ? 1 : _loc2_.selectedRadio.indexNumber;
  200.       var _loc3_ = 1;
  201.       while(_loc3_ < _loc2_.radioList.length)
  202.       {
  203.          if(_loc2_.radioList[_loc4_ - _loc3_] != undefined && _loc2_.radioList[_loc4_ - _loc3_].enabled)
  204.          {
  205.             var _loc5_ = this.getFocusManager();
  206.             _loc2_.radioList[_loc4_ - _loc3_].selected = true;
  207.             _loc5_.setFocus(_loc2_.radioList[_loc2_.selectedRadio.indexNumber]);
  208.             _loc2_.dispatchEvent({type:"click"});
  209.             break;
  210.          }
  211.          _loc3_ = _loc3_ + 1;
  212.       }
  213.    }
  214.    function set toggle(v)
  215.    {
  216.    }
  217.    function get toggle()
  218.    {
  219.    }
  220.    function set icon(v)
  221.    {
  222.    }
  223.    function get icon()
  224.    {
  225.    }
  226. }
  227.